if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Ports]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Ports]
GO

CREATE TABLE [dbo].[Ports] (
	[PortID] [tinyint] IDENTITY (1, 1) NOT NULL ,
	[PortName] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[SimNo] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[ComNo] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[BuadRate] [numeric](9, 2) NOT NULL ,
	[AutoStartonStartup] [bit] NOT NULL ,
	[LUser] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[LPwd] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Ports] WITH NOCHECK ADD 
	CONSTRAINT [PK_Ports] PRIMARY KEY  CLUSTERED 
	(
		[PortID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Ports] ADD 
	CONSTRAINT [DF_Ports_BuadRate_1] DEFAULT (0) FOR [BuadRate],
	CONSTRAINT [DF_Ports_AutoStartonStartup] DEFAULT (0) FOR [AutoStartonStartup]
GO

